package com.xmb.common.utils;

import java.math.BigDecimal;

/**
 * Created by lyndon on 2019/3/26.
 */
public class NumberUtils {

    public static int yuanToFee(float yuan) {
        return (int) (yuan * 100);
    }

    /**
     * 积分取整，向下取整，不保留小数
     * @param bigDecimal
     * @return
     */
    public static BigDecimal getRoundDownScoreNumber(BigDecimal bigDecimal) {
        return bigDecimal.setScale(0,BigDecimal.ROUND_DOWN);
    }

    /**
     * 奖金，保留2位小数
     * @param bigDecimal
     * @return
     */
    public static BigDecimal getRoundDownBonusNumber(BigDecimal bigDecimal) {
        return bigDecimal.setScale(2,BigDecimal.ROUND_DOWN);
    }

}
